const path = require('path')
const HtmlWebpackplugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports={
	entry:path.join(__dirname,'/src/main.js'),
	output:{
		filename:'bundle.js',
		path:path.join(__dirname,'./dist')
	},
	plugins:[
		new HtmlWebpackplugin({
			template:path.join(__dirname,'./src/index.html'),
			filename:'index.html'
		}),
		 new VueLoaderPlugin()
	],
	module:{
		rules:[
			{test:/\.css$/,loader:['style-loader','css-loader']},
			{test:/\.scss$/,loader:['style-loader','css-loader','sass-loader']},
			{test:/\.less$/,loader:['style-loader','css-loader','less-loader']},
			{test:/\.(jpg|png|gif|bmp|jpeg)$/,loader:'url-loader?name=[hash:8]-[name].[ext]'},
			{ 
				test: /\.js$/,
				loader: "babel-loader",
				exclude:__dirname + 'node_modules',
				include: __dirname + 'src',
			},
			{test:/\.vue$/,loader:'vue-loader'},
			{test:/\.(eot|svg|ttf|woff|woff2)$/,loader:'url-loader'}
		]
	}
}